﻿Imports System.Collections.Specialized

Public Class budgetUpdate

#Region "重载插入"
    Public Overrides Function DoInsert() As Boolean
        MyBase.DoInsert()
        Using frm As New BudgetAdd
            frm.iType = Me.iType
            frm.strName = Me.strName
            frm.ShowDialog()
            If frm.bAdd Then
                LoadData内容()
            End If
        End Using
        Return True
    End Function
#End Region

    Private Sub budgetUpdate_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LoadData内容()
        LoadData内容1()
        LoadData内容2()
    End Sub

    Public Sub LoadData内容()
        tv.Nodes.Clear()

        Dim 开始时间 As Date = New Date(Me.dt开始时间.Value.Year, Me.dt开始时间.Value.Month, 1)
        Dim 结束时间 As Date = New Date(Me.dt结束时间.Value.Year, Me.dt结束时间.Value.Month, 1)

        If 开始时间 > 结束时间 Then
            Exit Sub
        End If
        Dim dt用户 As DataTable = ct.FillTable("select * from WysInputUser where type=0 order by UserIndex")

        For Year As Integer = 开始时间.Year To 结束时间.Year
            Dim 开始月 As Integer = 1
            Dim 结束月 As Integer = 12
            If Year = 开始时间.Year Then
                开始月 = 开始时间.Month
            End If
            If Year = 结束时间.Year Then
                结束月 = 结束时间.Month
            End If

            For endmouth As Integer = 开始月 To 结束月
                Dim nd As System.Windows.Forms.TreeNode = tv.Nodes.Add(CStr(Year) & "年" & CStr(endmouth) & "月")
                Dim 合计4 As Decimal = 0
                If chk支出用户.Checked Then
                    For Each dr用户 As DataRow In dt用户.Rows
                        Dim 合计0 As Decimal = 0
                        Dim td1 As System.Windows.Forms.TreeNode = nd.Nodes.Add(dr用户("username"))
                        Dim dt支出类型 As DataTable = ct.FillTable("select * from XscBugType where ParentID=179 ")
                        For Each dr2 As DataRow In dt支出类型.Rows
                            Dim 合计1 As Decimal = 0
                            Dim td2 As System.Windows.Forms.TreeNode = td1.Nodes.Add(dr2("name"))
                            Dim dt支出类型1 As DataTable = ct.FillTable("select * from XscBugType where ParentID= " & CStr(dr2("id")))
                            If dt支出类型1.Rows.Count > 0 Then
                                For Each dr3 As DataRow In dt支出类型1.Rows
                                    Dim dt内容1 As DataTable = ct.FillTable("select * from budgetOut where TYPE= " & CStr(dr3("id")) & _
                                                                          " And UserName='" & CStr(dr用户("id")) & "' AND YEAR=" & CStr(Year) & " AND MONTH=" & CStr(endmouth))
                                    Dim 合计2 As Decimal = 0
                                    If dt内容1.Rows.Count > 0 Then
                                        For Each dr4 As DataRow In dt内容1.Rows
                                            合计2 += CDec(dr4("count"))
                                            合计1 += CDec(dr4("count"))
                                            合计0 += CDec(dr4("count"))
                                            合计4 += CDec(dr4("count"))
                                        Next
                                    End If
                                    Dim d5 As System.Windows.Forms.TreeNode = td2.Nodes.Add(dr3("name") & "[预算" & 合计2 & "]")
                                    If dt内容1.Rows.Count > 0 Then
                                        d5.Tag = dt内容1.Rows(0)("id")
                                    End If
                                Next
                            Else
                                Dim dt内容1 As DataTable = ct.FillTable("select * from budgetOut where TYPE= " & CStr(dr2("id")) & _
                                                                      " And UserName='" & CStr(dr用户("id")) & "' AND YEAR=" & CStr(Year) & " AND MONTH=" & CStr(endmouth))
                                If dt内容1.Rows.Count > 0 Then
                                    For Each dr4 As DataRow In dt内容1.Rows
                                        td2.Tag = dr4("id")
                                        合计1 += CDec(dr4("count"))
                                        合计0 += CDec(dr4("count"))
                                        合计4 += CDec(dr4("count"))
                                    Next
                                End If
                            End If
                            td2.Text = td2.Text & "[预算" & 合计1 & "]"
                        Next
                        td1.Text = td1.Text & "[预算" & 合计0 & "]"
                        td1.Expand()
                    Next
                    nd.Text = nd.Text & "[预算" & 合计4 & "]"
                    nd.Expand()
                Else
                    Dim dt支出类型 As DataTable = ct.FillTable("select * from XscBugType where ParentID=179 ")
                    For Each dr2 As DataRow In dt支出类型.Rows
                        Dim 合计1 As Decimal = 0
                        Dim td2 As System.Windows.Forms.TreeNode = nd.Nodes.Add(dr2("name"))
                        Dim dt支出类型1 As DataTable = ct.FillTable("select * from XscBugType where ParentID= " & CStr(dr2("id")))
                        If dt支出类型1.Rows.Count > 0 Then
                            For Each dr3 As DataRow In dt支出类型1.Rows
                                Dim dt内容1 As DataTable = ct.FillTable("select * from budgetOut where TYPE= " & CStr(dr3("id")) & _
                                                                       " AND YEAR=" & CStr(Year) & " AND MONTH=" & CStr(endmouth))
                                Dim 合计2 As Decimal = 0
                                If dt内容1.Rows.Count > 0 Then
                                    For Each dr4 As DataRow In dt内容1.Rows
                                        合计2 += CDec(dr4("count"))
                                        合计1 += CDec(dr4("count"))
                                        合计4 += CDec(dr4("count"))
                                    Next
                                End If
                                Dim d5 As System.Windows.Forms.TreeNode = td2.Nodes.Add(dr3("name") & "[预算" & 合计2 & "]")
                                If dt内容1.Rows.Count > 0 Then
                                    d5.Tag = dt内容1.Rows(0)("id")
                                End If
                            Next
                        Else
                            Dim dt内容1 As DataTable = ct.FillTable("select * from budgetOut where TYPE= " & CStr(dr2("id")) & _
                                                                   " AND YEAR=" & CStr(Year) & " AND MONTH=" & CStr(endmouth))
                            If dt内容1.Rows.Count > 0 Then
                                For Each dr4 As DataRow In dt内容1.Rows
                                    合计1 += CDec(dr4("count"))
                                    合计4 += CDec(dr4("count"))
                                    td2.Tag = dr4("id")
                                Next
                            End If
                        End If
                        td2.Text = td2.Text & "[预算" & 合计1 & "]"
                        td2.Expand()
                    Next
                    nd.Text = nd.Text & "[预算" & 合计4 & "]"
                    nd.Expand()
                End If
            Next
        Next
    End Sub

    Public Sub LoadData内容1()
        tv支出.Nodes.Clear()

        Dim strBegin As String
        Dim strEnd As String

        Dim 开始时间 As Date = New Date(Me.dt开始时间.Value.Year, Me.dt开始时间.Value.Month, 1)
        Dim 结束时间 As Date = New Date(Me.dt结束时间.Value.Year, Me.dt结束时间.Value.Month, 1)

        If 开始时间 > 结束时间 Then
            Exit Sub
        End If
        Dim dt用户 As DataTable = ct.FillTable("select * from WysInputUser where type=0 order by UserIndex")

        For Year As Integer = 开始时间.Year To 结束时间.Year
            Dim 开始月 As Integer = 1
            Dim 结束月 As Integer = 12
            If Year = 开始时间.Year Then
                开始月 = 开始时间.Month
            End If
            If Year = 结束时间.Year Then
                结束月 = 结束时间.Month
            End If

            strBegin = Year.ToString("0000") + "-" + 开始月.ToString("00") & "-" & "00"
            strEnd = Year.ToString("0000") + "-" + 开始月.ToString("00") & "-" & "31"

            For endmouth As Integer = 开始月 To 结束月
                Dim nd As System.Windows.Forms.TreeNode = tv支出.Nodes.Add(CStr(Year) & "年" & CStr(endmouth) & "月")
                Dim 合计4 As Decimal = 0
                If chk支出用户.Checked Then
                    For Each dr用户 As DataRow In dt用户.Rows
                        Dim 合计0 As Decimal = 0
                        Dim td1 As System.Windows.Forms.TreeNode = nd.Nodes.Add(dr用户("username"))
                        Dim dt支出类型 As DataTable = ct.FillTable("select * from XscBugType where ParentID=179 ")
                        For Each dr2 As DataRow In dt支出类型.Rows
                            Dim 合计1 As Decimal = 0
                            Dim td2 As System.Windows.Forms.TreeNode = td1.Nodes.Add(dr2("name"))
                            Dim dt支出类型1 As DataTable = ct.FillTable("select * from XscBugType where ParentID= " & CStr(dr2("id")))
                            If dt支出类型1.Rows.Count > 0 Then
                                For Each dr3 As DataRow In dt支出类型1.Rows
                                    Dim dt内容1 As DataTable = ct.FillTable("select sum(count) as count  from WysOutput where TYPE= " & CStr(dr3("id")) & _
                                                                          " And UserName='" & CStr(dr用户("id")) & _
                                                                         "' AND date([DateTime])>='" + strBegin + "'" & _
                                                                         " AND date([DateTime])<='" + strEnd + "' group by type  ")
                                    Dim 合计2 As Decimal = 0
                                    If dt内容1.Rows.Count > 0 Then
                                        For Each dr4 As DataRow In dt内容1.Rows
                                            合计2 += CDec(dr4("count"))
                                            合计1 += CDec(dr4("count"))
                                            合计0 += CDec(dr4("count"))
                                            合计4 += CDec(dr4("count"))
                                        Next
                                    End If
                                    td2.Nodes.Add(dr3("name") & "[消费" & 合计2 & "]")
                                Next
                            Else
                                Dim dt内容1 As DataTable = ct.FillTable("select sum(count) as count   from WysOutput where TYPE= " & CStr(dr2("id")) & _
                                                                      " And UserName='" & CStr(dr用户("id")) & _
                                                                       "' AND date([DateTime])>='" + strBegin + "'" & _
                                                                         " AND date([DateTime])<='" + strEnd + "' group by type  ")
                                If dt内容1.Rows.Count > 0 Then
                                    For Each dr4 As DataRow In dt内容1.Rows
                                        合计1 += CDec(dr4("count"))
                                        合计0 += CDec(dr4("count"))
                                        合计4 += CDec(dr4("count"))
                                    Next
                                End If
                            End If
                            td2.Text = td2.Text & "[消费" & 合计1 & "]"
                        Next
                        td1.Text = td1.Text & "[消费" & 合计0 & "]"
                        td1.Expand()
                    Next
                    nd.Text = nd.Text & "[消费" & 合计4 & "]"
                    nd.Expand()
                Else
                    Dim dt支出类型 As DataTable = ct.FillTable("select * from XscBugType where ParentID=179 ")
                    For Each dr2 As DataRow In dt支出类型.Rows
                        Dim 合计1 As Decimal = 0
                        Dim td2 As System.Windows.Forms.TreeNode = nd.Nodes.Add(dr2("name"))
                        Dim dt支出类型1 As DataTable = ct.FillTable("select * from XscBugType where ParentID= " & CStr(dr2("id")))
                        If dt支出类型1.Rows.Count > 0 Then
                            For Each dr3 As DataRow In dt支出类型1.Rows
                                Dim dt内容1 As DataTable = ct.FillTable("select sum(count)  as count  from WysOutput where TYPE= " & CStr(dr3("id")) & _
                                                                        " AND date([DateTime])>='" + strBegin + "'" & _
                                                                         " AND date([DateTime])<='" + strEnd + "' group by type  ")
                                Dim 合计2 As Decimal = 0
                                If dt内容1.Rows.Count > 0 Then
                                    For Each dr4 As DataRow In dt内容1.Rows
                                        合计2 += CDec(dr4("count"))
                                        合计1 += CDec(dr4("count"))
                                        合计4 += CDec(dr4("count"))
                                    Next
                                End If
                                td2.Nodes.Add(dr3("name") & "[消费" & 合计2 & "]")
                            Next
                        Else
                            Dim dt内容1 As DataTable = ct.FillTable("select sum(count) as count   from WysOutput where TYPE= " & CStr(dr2("id")) & _
                                                                    " AND date([DateTime])>='" + strBegin + "'" & _
                                                                         " AND date([DateTime])<='" + strEnd + "' group by type  ")
                            If dt内容1.Rows.Count > 0 Then
                                For Each dr4 As DataRow In dt内容1.Rows
                                    合计1 += CDec(dr4("count"))
                                    合计4 += CDec(dr4("count"))
                                Next
                            End If
                        End If
                        td2.Text = td2.Text & "[消费" & 合计1 & "]"
                        td2.Expand()
                    Next
                    nd.Text = nd.Text & "[消费" & 合计4 & "]"
                    nd.Expand()
                End If
            Next
        Next
    End Sub

    Public Sub LoadData内容2()
        tv结余.Nodes.Clear()

        Dim strBegin As String
        Dim strEnd As String

        Dim 开始时间 As Date = New Date(Me.dt开始时间.Value.Year, Me.dt开始时间.Value.Month, 1)
        Dim 结束时间 As Date = New Date(Me.dt结束时间.Value.Year, Me.dt结束时间.Value.Month, 1)

        If 开始时间 > 结束时间 Then
            Exit Sub
        End If
        Dim dt用户 As DataTable = ct.FillTable("select * from WysInputUser where type=0 order by UserIndex")

        For Year As Integer = 开始时间.Year To 结束时间.Year
            Dim 开始月 As Integer = 1
            Dim 结束月 As Integer = 12
            If Year = 开始时间.Year Then
                开始月 = 开始时间.Month
            End If
            If Year = 结束时间.Year Then
                结束月 = 结束时间.Month
            End If

            strBegin = Year.ToString("0000") + "-" + 开始月.ToString("00") & "-" & "00"
            strEnd = Year.ToString("0000") + "-" + 开始月.ToString("00") & "-" & "31"

            For endmouth As Integer = 开始月 To 结束月
                Dim nd As System.Windows.Forms.TreeNode = tv结余.Nodes.Add(CStr(Year) & "年" & CStr(endmouth) & "月")
                Dim 合计4 As Decimal = 0
                If chk支出用户.Checked Then
                    For Each dr用户 As DataRow In dt用户.Rows
                        Dim 合计0 As Decimal = 0
                        Dim td1 As System.Windows.Forms.TreeNode = nd.Nodes.Add(dr用户("username"))
                        Dim dt支出类型 As DataTable = ct.FillTable("select * from XscBugType where ParentID=179 ")
                        For Each dr2 As DataRow In dt支出类型.Rows
                            Dim 合计1 As Decimal = 0
                            Dim td2 As System.Windows.Forms.TreeNode = td1.Nodes.Add(dr2("name"))
                            Dim dt支出类型1 As DataTable = ct.FillTable("select * from XscBugType where ParentID= " & CStr(dr2("id")))
                            If dt支出类型1.Rows.Count > 0 Then
                                For Each dr3 As DataRow In dt支出类型1.Rows
                                    Dim dt内容1 As DataTable = ct.FillTable("select sum(count) as count  from WysOutput where TYPE= " & CStr(dr3("id")) & _
                                                                          " And UserName='" & CStr(dr用户("id")) & _
                                                                         "' AND date([DateTime])>='" + strBegin + "'" & _
                                                                         " AND date([DateTime])<='" + strEnd + "' group by type  ")
                                    Dim dt内容1_1 As DataTable = ct.FillTable("select * from budgetOut where TYPE= " & CStr(dr3("id")) & _
                                      " And UserName='" & CStr(dr用户("id")) & "' AND YEAR=" & CStr(Year) & " AND MONTH=" & CStr(endmouth))

                                    Dim 合计2 As Decimal = 0
                                    If dt内容1.Rows.Count > 0 Then
                                        For Each dr4 As DataRow In dt内容1.Rows
                                            合计2 -= CDec(dr4("count"))
                                            合计1 -= CDec(dr4("count"))
                                            合计0 -= CDec(dr4("count"))
                                            合计4 -= CDec(dr4("count"))
                                        Next
                                    End If

                                    If dt内容1_1.Rows.Count > 0 Then
                                        For Each dr4 As DataRow In dt内容1_1.Rows
                                            合计2 += CDec(dr4("count"))
                                            合计1 += CDec(dr4("count"))
                                            合计0 += CDec(dr4("count"))
                                            合计4 += CDec(dr4("count"))
                                        Next
                                    End If
                                    td2.Nodes.Add(dr3("name") & "[结余" & 合计2 & "]")
                                Next
                            Else
                                Dim dt内容1 As DataTable = ct.FillTable("select sum(count) as count   from WysOutput where TYPE= " & CStr(dr2("id")) & _
                                                                      " And UserName='" & CStr(dr用户("id")) & _
                                                                       "' AND date([DateTime])>='" + strBegin + "'" & _
                                                                         " AND date([DateTime])<='" + strEnd + "' group by type  ")

                                Dim dt内容1_1 As DataTable = ct.FillTable("select * from budgetOut where TYPE= " & CStr(dr2("id")) & _
                                      " And UserName='" & CStr(dr用户("id")) & "' AND YEAR=" & CStr(Year) & " AND MONTH=" & CStr(endmouth))

                                If dt内容1.Rows.Count > 0 Then
                                    For Each dr4 As DataRow In dt内容1.Rows
                                        合计1 -= CDec(dr4("count"))
                                        合计0 -= CDec(dr4("count"))
                                        合计4 -= CDec(dr4("count"))
                                    Next
                                End If

                                If dt内容1_1.Rows.Count > 0 Then
                                    For Each dr4 As DataRow In dt内容1_1.Rows
                                        合计1 += CDec(dr4("count"))
                                        合计0 += CDec(dr4("count"))
                                        合计4 += CDec(dr4("count"))
                                    Next
                                End If
                            End If
                            td2.Text = td2.Text & "[结余" & 合计1 & "]"
                        Next
                        td1.Text = td1.Text & "[结余" & 合计0 & "]"
                        td1.Expand()
                    Next
                    nd.Text = nd.Text & "[结余" & 合计4 & "]"
                    nd.Expand()
                Else
                    Dim dt支出类型 As DataTable = ct.FillTable("select * from XscBugType where ParentID=179 ")
                    For Each dr2 As DataRow In dt支出类型.Rows
                        Dim 合计1 As Decimal = 0
                        Dim td2 As System.Windows.Forms.TreeNode = nd.Nodes.Add(dr2("name"))
                        Dim dt支出类型1 As DataTable = ct.FillTable("select * from XscBugType where ParentID= " & CStr(dr2("id")))
                        If dt支出类型1.Rows.Count > 0 Then
                            For Each dr3 As DataRow In dt支出类型1.Rows
                                Dim dt内容1 As DataTable = ct.FillTable("select sum(count)  as count  from WysOutput where TYPE= " & CStr(dr3("id")) & _
                                                                        " AND date([DateTime])>='" + strBegin + "'" & _
                                                                         " AND date([DateTime])<='" + strEnd + "' group by type  ")

                                Dim dt内容1_1 As DataTable = ct.FillTable("select * from budgetOut where TYPE= " & CStr(dr3("id")) & _
                                                                       " AND YEAR=" & CStr(Year) & " AND MONTH=" & CStr(endmouth))
                                Dim 合计2 As Decimal = 0
                                If dt内容1.Rows.Count > 0 Then
                                    For Each dr4 As DataRow In dt内容1.Rows
                                        合计2 -= CDec(dr4("count"))
                                        合计1 -= CDec(dr4("count"))
                                        合计4 -= CDec(dr4("count"))
                                    Next
                                End If

                                If dt内容1_1.Rows.Count > 0 Then
                                    For Each dr4 As DataRow In dt内容1_1.Rows
                                        合计2 += CDec(dr4("count"))
                                        合计1 += CDec(dr4("count"))
                                        合计4 += CDec(dr4("count"))
                                    Next
                                End If

                                td2.Nodes.Add(dr3("name") & "[结余" & 合计2 & "]")
                            Next
                        Else
                            Dim dt内容1 As DataTable = ct.FillTable("select sum(count) as count   from WysOutput where TYPE= " & CStr(dr2("id")) & _
                                                                    " AND date([DateTime])>='" + strBegin + "'" & _
                                                                         " AND date([DateTime])<='" + strEnd + "' group by type  ")

                            Dim dt内容1_1 As DataTable = ct.FillTable("select * from budgetOut where TYPE= " & CStr(dr2("id")) & _
                                                                   " AND YEAR=" & CStr(Year) & " AND MONTH=" & CStr(endmouth))
                            If dt内容1.Rows.Count > 0 Then
                                For Each dr4 As DataRow In dt内容1.Rows
                                    合计1 -= CDec(dr4("count"))
                                    合计4 -= CDec(dr4("count"))
                                Next
                            End If

                            If dt内容1_1.Rows.Count > 0 Then
                                For Each dr4 As DataRow In dt内容1_1.Rows
                                    合计1 += CDec(dr4("count"))
                                    合计4 += CDec(dr4("count"))
                                Next
                            End If

                        End If
                        td2.Text = td2.Text & "[结余" & 合计1 & "]"
                        td2.Expand()
                    Next
                    nd.Text = nd.Text & "[结余" & 合计4 & "]"
                    nd.Expand()
                End If
            Next
        Next
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        LoadData内容()
        LoadData内容1()
        LoadData内容2()
    End Sub

    Public Overrides Sub 保存窗体数据到数据库(ByRef dtData As System.Data.DataTable)
        '年
        dtData.Rows.Add(New String() {"开始时间", "", dt开始时间.Value.ToString("yyyy-MM-dd")})
        dtData.Rows.Add(New String() {"结束时间", "", dt结束时间.Value.ToString("yyyy-MM-dd")})

        If chk支出用户.Checked Then
            dtData.Rows.Add(New String() {"收入用户", "", "是"})
        Else
            dtData.Rows.Add(New String() {"收入用户", "", "否"})
        End If

        If Me.rad支出时间月.Checked Then
            dtData.Rows.Add(New String() {"收入时间月", "", "1"})
        Else
            dtData.Rows.Add(New String() {"收入时间月", "", "2"})
        End If

        MyBase.保存窗体数据到数据库(dtData)
    End Sub

    Public Overrides Sub 存取数据库数据到窗体(ByVal dtDbData As System.Data.DataTable)

        If dtDbData.Rows.Count > 0 Then
            '年
            dt开始时间.Value = 查找数据("开始时间", "", Now.ToString("yyyy-MM-dd"), dtDbData)
            dt结束时间.Value = 查找数据("结束时间", "", Now.ToString("yyyy-MM-dd"), dtDbData)
            chk支出用户.Checked = IIf(查找数据("收入用户", "", "否", dtDbData) = "否", False, True)

            rad支出时间月.Checked = IIf(查找数据("收入时间月", "", "1", dtDbData) = "1", True, False)
            rad支出时间年.Checked = IIf(查找数据("收入时间月", "", "1", dtDbData) = "2", True, False)

        End If
        MyBase.存取数据库数据到窗体(dtDbData)
    End Sub

    Private Sub tv_NodeMouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles tv.NodeMouseDoubleClick, tv结余.NodeMouseDoubleClick, tv支出.NodeMouseDoubleClick

        If e.Node.Nodes.Count > 0 OrElse chk支出用户.Checked = False OrElse e.Node.Tag Is Nothing Then
            Exit Sub
        End If

        Dim id As String = e.Node.Tag.ToString
        If id.Length < 36 Then Exit Sub
        If id.Length = 36 Then
            Using frm As BudgetAdd = New BudgetAdd
                frm.参数列表.Add("ID", id)
                frm.模式 = Wys.Control.Vb.InsertFormBase.模式型.修正
                frm.iType = Me.iType
                frm.strName = Me.strName
                frm.ShowDialog()
                If frm.bAdd Then
                    LoadData内容()
                End If
            End Using
        End If
    End Sub

#Region "删除CHECK"
    Public Overrides Function DoDeleteCheck() As Boolean
        DoDeleteCheck = False

        If tv.SelectedNode Is Nothing Then Exit Function
        If Me.tv.SelectedNode.Nodes.Count > 0 OrElse chk支出用户.Checked = False OrElse tv.SelectedNode.Tag Is Nothing Then
            ShowMessageBox("没有选中任何记录")
            Exit Function
        End If

        Dim id As String = tv.SelectedNode.Tag.ToString
        If id.Length <> 36 Then
            ShowMessageBox("没有选中任何记录")
            Exit Function
        End If
        strid = id
        If ShowMessageResult("是否删除本条记录") = Windows.Forms.DialogResult.No Then Exit Function

        DoDeleteCheck = True
    End Function
#End Region

#Region "重载删除事件"

    Dim strid As String = ""
    Public Overrides Function DoDelete() As Boolean

        Dim CMD As New ADODB.Command
        CMD.CommandText = "DELETE from budgetOut  where ID='" + strid + "'"
        If ct.ExcCommand(CMD) Then
            ShowMessageBox("删除成功")
        Else
            ShowMessageBox("删除失败")
        End If

        LoadData内容()
        Return True
    End Function
#End Region
End Class
